<template>
<div class="search">
      <el-button type="primary" size="small" @click="editRef.drawer=true">添加</el-button>
    </div>
   <el-table size="small" :data="list" style="width: 98%">
      <el-table-column prop="name" label="名字" width="100" />
      <!-- <el-table-column prop="password" label="密码" width="150" /> -->
      <el-table-column prop="sex" label="性别" width="100" />
      <el-table-column prop="age" label="年龄" width="100" />
      <el-table-column prop="phone" label="手机" width="100" />
      <el-table-column prop="hotelId" label="酒店Id" width="100" />
      <el-table-column prop="work" label="职位" width="100"/>
      <el-table-column prop="salary" label="薪水" width="100" />
      <el-table-column label="操作" width='150'>
          <template #default="scope">
          <el-button size="small" @click="handleEdit(scope.row.id)">编辑</el-button>
          <el-button
            size="small"
            type="danger"
            @click="handleDelete(scope.row.id)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
</template>

<script setup lang="ts">
import {onMounted,ref,computed}from 'vue'
import {$list} from "../../api/employ.js"


let list =ref([])
const loadList=async()=>{
  console.log(1111);
  
  let ref =await $list()
  
  
  list.value=ref.data.employee
  console.log(list);
}

// //删除方法
// const handleDelete=(id ,phone)=>{
//     ElMessageBox.confirm(
//     '确定删除吗？',
//     '系统提示',
//     {
//       confirmButtonText: '确定',
//       cancelButtonText: '取消',
//       type: 'warning',
//     }
//   )
//   .then(async () => {
//     let ret = await $delete({id,photo})
//           if(!ret.success){
//           ElNotification({
//             title: '提示',
//             message: ret.message,
//             type: 'success',
//           })
//           //重新加载
//           loadRoles()
           
//         }else{
//           ElNotification({
//             title: '提示',
//             message: ret.message,
//             type: 'error',
//           }) 
//           console.log(roledId)
//         }
//   })
//   .catch(() => {})
  
// }

// //编辑方法
// const handleEdit = async (roleId)=>{
//   console.log(roleId);
//     formData.value.id=roleId
//       console.log(formData.value);
//   let ret =await $getOne(formData.value)
//   console.log(ret.data.page);
//   editRef.value.drawer = true ·
//   editRef.value.formData = ret.data.page.records
// }
onMounted(()=>{
  loadList()
})


</script>

<style lang="scss" scoped>

</style>